# -*- coding: utf-8 -*-
import xlrd

filepath = "./B-2廖铸_现有目录.xls"
data = xlrd.open_workbook(filepath)
names = data.sheet_names()

for name in names:
    table = data.sheet_by_name(name)
    data.sheet_loaded(name)
    max_rows = table.nrows

    sheet_head = []
    """取数据"""
    j = 0
    k = 0
    l = 0
    for i in range(max_rows):
        j += 1
        if j > 4:
            if '\u4e00' <= table.row_values(i)[0] <= '\u9fa5':
                k += 1
                temp = []
                temp.append(table.row_values(i))
                sheet_head.append(temp)
                l = 0
            elif "（" in table.row_values(i)[0]:
                l += 1
                temp = table.row_values(i)[:]
                temp[0] = str(k) + "-" + str(l)
                sheet_group = []
                if l == 1:
                    del sheet_head[-1]
                    sheet_group.append(table.row_values(i - l))
                    sheet_group.append(temp)
                    sheet_head.append(sheet_group)
                else:
                    sheet_group.append(temp)
                    sheet_head.append(sheet_group)

    # print(sheet_head)
